// teste do yam com a instrução BEQ

package main

import (
  "ygo"
  "fmt"
)


func main() {

	load := make(chan int32)
	instruction_address := make(chan uint32)
	instruction := make(chan uint32)
	end := make(chan int32)
	ls_addr := make(chan uint32)
	ls_rw := make(chan bool)
	ls_data_in := make(chan int32)
	ls_data_out := make(chan int32)



	go ygo.Memory(load, instruction_address, instruction, ls_addr, ls_rw, ls_data_in, ls_data_out)
	go ygo.Yam(instruction_address,instruction, ls_addr, ls_rw, ls_data_in, ls_data_out)

	fmt.Println("[TB ] Sending data to memory")

// 	for i:=0; i<5; i++{
// 		load <- 0x10800009 //   beq r4,r0, L
// 	}
	load <- 0x10800009
	load <- 98340
	load <- 98340
	load <- 98340
	
	fmt.Println("[TB ] Closing memory")
	close(load)

	fmt.Println("[TB ] Infinite loop")
	for {
		<- end
	} 

}
